
clear 

** read in .dta file **

use "${clean}/who_counts_analysis.dta", clear

** full regression results for Formal Schooling outcome **


** regressions ** 

xi: reghdfe Schooling did_edu_ANY, a(geo2_ma YOB) cluster(geo2_ma)
estadd local controls = "$$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_School_did_BW2_none

xi: reghdfe Schooling did_edu_ANY Arabic Female *_itTREATEDEDU *_itANYFOR, a(geo2_ma reg_fe YOB) cluster(geo2_ma)
estadd local controls = "$\surd$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_School_did_BW2_any

drop if YOB > 1955

xi: reghdfe Schooling did_edu_ANY, a(geo2_ma YOB) cluster(geo2_ma)
estadd local controls = "$$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_School_did_BW1_none

xi: reghdfe Schooling did_edu_ANY Arabic Female *_itTREATEDEDU *_itANYFOR, a(geo2_ma reg_fe YOB) cluster(geo2_ma)
estadd local controls = "$\surd$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_School_did_BW1_any

** Output Table **

#delimit ; 
estout 
m_School_did_BW1_none
m_School_did_BW1_any
m_School_did_BW2_none
	   m_School_did_BW2_any
       using "${output}/tables/TableA7.tex",
       style(tex) 
       cells(b(star fmt(3)) se(par fmt(3))) 
varlabels(did_edu_ANY "Difference in Differences, education" Female "Female " Arabic "First Language Arabic " Arabic_itTREATEDEDU "Arabic, Post 1950 Interaction " Female_itTREATEDEDU  "Female, Post 1950 Interaction" n_schools52_itTREATEDEDU  "Number of Schools 1952, Post 1950 Interaction" n_students52_itTREATEDEDU  "Number of Students 1952, Post 1950 Interaction"  n_classes52_itTREATEDEDU "Number of Classes 1952, Post 1950 Interaction" Coastal "Coastal" elev_mean "Mean Altitude (Province)" popd_1910_itTREATEDEDU  " Estimated Pre-colonial population density, Post 1950 Interaction "  Coastal_itTREATEDEDU  "Coastal Post 1950 Interaction" elev_mean_itTREATEDEDU  "Mean Elevation Post 1950 Interaction" cropland1910_itTREATEDEDU  "Estimated pre-colonial Cropland Post 1950 Interaction" Arabic_itANYFOR "Arabic Foreign Municipal Population Interaction" Female_itANYFOR "Female Foreign Municipal Population Share interaction" Coastal_itANYFOR "Coastal Foreign Municipal Population Share interaction" ARABIC_itANYFOR "Arabic Historic European Population Interaction " elev_mean_itANYFOR "Mean Elevation Foreign Municipal Population Share interaction" cropland1910_itANYFOR "Estimated pre-colonial Cropland Foreign Municipal Population Share interaction" popd_1910_itANYFOR "Estimated pre-colonial population density Foreign Municipal Population Share interaction")
       drop(_cons ec_total_itANYFOR Coastal_itANYFOR elev_mean_itANYFOR cropland1910_itANYFOR popd_1910_itANYFOR)
	   stats(controls
	   adminFE
             r2 
             N
			 ymean, fmt(0 0 2 0 3 %9.0gc %9.0gc)
             labels("\hline Controls"
			 "\hline Admin FE"
                   "\hline \(R^2\)" 
                  " \hline N"
				   "Dep. Var. Mean "))
       mlabels(,none) 
       numbers
       collabels(none) 
       starl(* 0.1 ** 0.05 *** 0.01)
	          prehead( 
           \begin{table}[H]
           \caption{Effect of 1950 Reform and European Settlement on Formal Schooling}        
           \label{tab:DiD_Schooling}            
           \centering
           \begin{tabular}{@{\extracolsep{4pt}}l*{@M}{c}@{}} 
           \hline \hline             
		   & \multicolumn{1}{p{3cm}}{\centering Formal Schooling \\ 1945-1955}     
		   & \multicolumn{1}{p{3cm}}{\centering Formal Schooling \\ 1945-1955}   
		    & \multicolumn{1}{p{3cm}}{\centering Formal Schooling \\ 1945-1962}                
		   & \multicolumn{1}{p{3cm}}{\centering Formal Schooling \\ 1945-1962}                 \\                  
       )
       posthead(\hline) 
       prefoot() 
       postfoot(
           \noalign{\smallskip} \hline \hline 
           \end{tabular}
           \medskip
           \begin{minipage}{.9\textwidth}
           \tiny \justify Notes: \( @starlegend \). 
           \\ Fixed Effects and Clustered Robust Standard Errors at Province.
           \end{minipage}        
       \end{table}
       )
       replace;
#delimit cr
